package com.flexcodejam.vfd.command {

	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.adobe.cairngorm.control.CairngormEventDispatcher;

	import com.flexcodejam.vfd.business.*;
	import com.flexcodejam.vfd.control.*;
	import com.flexcodejam.vfd.event.*;
	import com.flexcodejam.vfd.model.*;
	import com.flexcodejam.vfd.vo.*;

	import mx.collections.ArrayCollection;
	import mx.rpc.IResponder;
	import mx.rpc.events.*;
	import mx.controls.Alert;
	import mx.utils.ObjectUtil;
	import flash.events.Event;


	public class ChangeMainViewStackCommand implements ICommand, IResponder
	{
		private var model:VFDModelLocator = VFDModelLocator.getInstance();

		public function ChangeMainViewStackCommand():void
		{
			// constructor...
		}

		public function execute(event:CairngormEvent):void
		{

			//var ev:FoodDriveEvent = new FoodDriveEvent(FoodDriveEvent.GetAll,true,false);

			var ev:ChangeMainViewStackEvent = event as ChangeMainViewStackEvent;

			switch (event.type)	 {
			case "DonationBoard":
				model.currentViewStackIndex = 0;
			break;

			case "FoodDriveView":
				model.currentViewStackIndex = 1;
			break;

			case "MakeDonation":
				model.currentViewStackIndex = 2;
			break;

			case "Confirmation":
			model.currentViewStackIndex = 3;
			break;



			case "NewEditFoodDrive":
			case "LoginNewFoodDrive":
			model.currentViewStackIndex = 4;
			break;

			case "EditFoodDrive":
			model.currentViewStackIndex = 5;
			break;

			case "SuperUser":
			model.currentViewStackIndex = 6;
			break;

			case "ThankYou":
			model.currentViewStackIndex = 7;
			break;


			}

		}


		public function result(event:Object):void
		{

		}

			public function fault(event:Object):void
		{

		}

	}


}

